package com.daxia.wxpay.service;

import com.daxia.bumall.common.Logs;
import com.daxia.wxpay.common.Configure;
import com.daxia.wxpay.protocol.pay_query_protocol.ScanPayQueryReqData;

/**
 * User: rizenguo
 * Date: 2014/10/29
 * Time: 16:04
 */
public class ScanPayQueryService extends BaseService{

    public ScanPayQueryService() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        super(Configure.PAY_QUERY_API);
    }

    /**
     * 请求支付查询服务
     * @param scanPayQueryReqData 这个数据对象里面包含了API要求提交的各种数据字段
     * @return API返回的XML数据
     * @throws Exception
     */
    public String request(ScanPayQueryReqData scanPayQueryReqData) throws Exception {

        //--------------------------------------------------------------------
        //发送HTTPS的Post请求到API地址
        //--------------------------------------------------------------------
        String responseString = sendPost(scanPayQueryReqData);

        return responseString;
    }

    public static void main(String[] args) throws Exception {
		ScanPayQueryReqData data = new ScanPayQueryReqData(null, "BY1201611171106367176","4DBA02F3F6994E74A77A76A6AE1280FF");
		data.setAppid("wx3bb22e6f66087555");
		data.setMch_id("1267043101");
		ScanPayQueryService service = new ScanPayQueryService();
		Logs.COMMON.debug("xml = "+service.request(data));
	}
}